<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
      function data(){
          let cache=data.cache || (data.cache=new Map());
          let n=1;
          this.show=()=>{
                  ++n;
                 cache.set("number",n);
                 console.log(cache);
                
          }
          this.newdata=()=>{
              return (new data);
          }
      }
     setTimeout(() => {
         let newdata=(new data).newdata();
         setInterval(() => {
              newdata.show();
         }, 2000);
     }, 1000);
    </script>
</body>
</html>\